/*     */ package dm.jdbc.pool;
/*     */ 
/*     */ import java.sql.SQLException;
/*     */ import javax.sql.ConnectionEvent;
/*     */ import javax.sql.ConnectionEventListener;
/*     */ import javax.sql.DataSource;
/*     */ import javax.sql.PooledConnection;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class DmdbConnectionEventListener
/*     */   implements ConnectionEventListener
/*     */ {
/*  32 */   private DmdbConnectionEventListener_bs rCEvnt = null;
/*     */   
/*     */   DmdbConnectionEventListener(DmdbConnectionEventListener_bs cevent)
/*     */   {
/*  36 */     this.rCEvnt = cevent;
/*     */   }
/*     */   
/*     */   public DmdbConnectionEventListener() {
/*  40 */     this.rCEvnt = new DmdbConnectionEventListener_bs();
/*     */   }
/*     */   
/*     */   DmdbConnectionEventListener_bs getRealCEvnt() {
/*  44 */     return this.rCEvnt;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public synchronized void connectionClosed(ConnectionEvent event)
/*     */   {
/*     */     try
/*     */     {
/*  59 */       if (this.rCEvnt.checkDataSource()) {
/*  60 */         Object src = event.getSource();
/*  61 */         PooledConnection pc = null;
/*  62 */         if ((src instanceof DmdbPooledConnection)) {
/*  63 */           pc = ((DmdbPooledConnection)src).getRealPConn();
/*     */         } else {
/*  65 */           pc = (PooledConnection)src;
/*     */         }
/*     */         
/*  68 */         ((DmdbConnectionCache_bs)this.rCEvnt.getDataSource()).reusePooledConnection(pc);
/*     */       }
/*     */     } catch (SQLException _ex) {
/*  71 */       _ex.printStackTrace();
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public synchronized void connectionErrorOccurred(ConnectionEvent event)
/*     */   {
/*     */     try
/*     */     {
/*  85 */       if (this.rCEvnt.checkDataSource()) {
/*  86 */         Object src = event.getSource();
/*  87 */         PooledConnection pc = null;
/*  88 */         if ((src instanceof DmdbPooledConnection)) {
/*  89 */           pc = ((DmdbPooledConnection)src).getRealPConn();
/*     */         } else {
/*  91 */           pc = (PooledConnection)src;
/*     */         }
/*     */         
/*  94 */         ((DmdbConnectionCache_bs)this.rCEvnt.getDataSource()).closePooledConnection(pc);
/*     */       }
/*     */     } catch (SQLException _ex) {
/*  97 */       _ex.printStackTrace();
/*     */     }
/*     */   }
/*     */   
/*     */   public void setDataSource(DataSource datasource) {
/* 102 */     if ((datasource instanceof DmdbConnectionCache)) {
/* 103 */       this.rCEvnt.setDataSource(((DmdbConnectionCache)datasource)
/* 104 */         .getRealConnCache());
/*     */     }
/* 106 */     if ((datasource instanceof DmdbConnectionPoolDataSource)) {
/* 107 */       this.rCEvnt.setDataSource(((DmdbConnectionPoolDataSource)datasource)
/* 108 */         .getRealPds());
/*     */     }
/* 110 */     if ((datasource instanceof DmdbDataSource)) {
/* 111 */       this.rCEvnt.setDataSource(((DmdbDataSource)datasource).getRealDbSrc());
/*     */     }
/*     */   }
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\pool\DmdbConnectionEventListener.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */